package com.nf.test;

import java.sql.*;

public class StudentDaoImpl implements StudentDao {

    @Override
    public Student findStudentById(int studId) {
        Student student = null;
        return student;
    }

//    @Override
//    public Student findStudentById(int studId){
//        String jdbcUrl="jdbc:mysql://localhost:3306/oa?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true";
//        Student student = null;
//        Connection conn;
//        try {
//            Class.forName("com.mysql.cj.jdbc.Driver");
//            conn = DriverManager.getConnection(jdbcUrl, "root", "123456");
//        ,    PreparedStatement pst = conn.prepareStatement(" select * from students where stud_id=?;");
//            pst.setInt(1,studId);
//            ResultSet rs = pst.executeQuery();
//            if(rs.next()) {
//                student = new Student();
//                student.setStudId(rs.getInt("stud_Id"));
//                student.setName(rs.getString("name"));
//                student.setEmail(rs.getString("email"));
//                student.setDob(rs.getDate("dob"));
//            }
//            rs.close();
//            pst.close();
//            conn.close();
//        }catch (Exception e){
//            e.printStackTrace();
//            return null;
//        }
//
//        return student;
//    }
}
